const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
    app.use(
        //代理1
        createProxyMiddleware('/api1', {
            //要访问的地址
            target: 'https://www.ydzhcg.com:7888',
            changeOrigin: true,
            pathRewrite: { '^/api1': '' } //重写请求路径(必须)
        }
        ),
        //代理2
        createProxyMiddleware('/api2', {
            //要访问的地址
            target: 'http://localhost:9009',
            changeOrigin: true,
            pathRewrite: { '^/api2': '' } //重写请求路径(必须)
        }
        ),
        //代理3
        createProxyMiddleware('/api3', {
            //要访问的地址
            target: 'https://apis.map.qq.com',
            changeOrigin: true,
            pathRewrite: { '^/api3': '' } //重写请求路径(必须)
        }
        ),
    );
};
